package com.languohui.lgh.controller;

import com.languohui.lgh.util.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    private RedisUtils redisUtils;
    /**
     * 设置值
     * @param key
     * @param value
     */
    @PostMapping("/setValue")
    public void setValue(String key,String value){
        redisUtils.setValue(key, value);
    }

    /**
     * 获取值
     * @param key
     */
    @GetMapping("/getValue")
    public String getValue(String key){
       return redisUtils.getValue(key);
    }
}
